import os

BASE_DIR = os.path.abspath(os.path.dirname(__file__))
UPLOAD_FOLDER = os.path.join(BASE_DIR, 'temp/uploads')
CONVERTED_FOLDER = os.path.join(BASE_DIR, 'temp/converted')
PDF_IMG_FOLDER = os.path.join(BASE_DIR, 'temp/pdf_images')  
PNG_OUTPUT_FOLDER = os.path.join(BASE_DIR, 'temp/png_output')

# 确保所有目录都存在
os.makedirs(UPLOAD_FOLDER, exist_ok=True)
os.makedirs(CONVERTED_FOLDER, exist_ok=True)
os.makedirs(PDF_IMG_FOLDER, exist_ok=True)
os.makedirs(PNG_OUTPUT_FOLDER, exist_ok=True)
ALLOWED_EXTENSIONS = {
    'doc': ['doc', 'docx', 'ppt', 'pptx'],
    'excel': ['xls', 'xlsx']
}

# 文件类型配置
TO_PDF_TYPES = os.getenv('TO_PDF_TYPES', 'doc,ppt,pptx').split(',')
TO_MD_TYPES = os.getenv('TO_MD_TYPES', 'xls').split(',')
DIRECT_UPLOAD_TYPES = os.getenv('DIRECT_UPLOAD_TYPES', 'docx,xlsx,pdf').split(',')